﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Interactivity;

namespace WpfWordsLearner
{
	public class OnGiveFeedbackAction : TriggerAction<DataGrid>
	{
		protected override void OnAttached()
		{
			base.OnAttached();
		}

		protected override void OnDetaching()
		{
			base.OnDetaching();
		}

		protected override void Invoke(object parameter)
		{
			if (parameter != null && (parameter is System.Windows.GiveFeedbackEventArgs))
			{
				if (Keyboard.GetKeyStates(Key.RightCtrl) == KeyStates.Down || Keyboard.GetKeyStates(Key.LeftCtrl) == KeyStates.Down)
				{
					(parameter as System.Windows.GiveFeedbackEventArgs).Handled = true;
				}
			}
		}
	}
}